package com.xwh.week2;

public class Practice14 {
    public static void main(String[] args) {
        System.out.println(method(1000000));
    }
    public static long method(long n){
        int ans=0;
        long num=0;
        for(long i=n;i>=1;i--){
            int count=0;
            long temp=i;
            while(temp!=1){
                if(temp%2==0){
                    temp/=2;
                    count++;
                }else {
                    temp=3*temp+1;
                    count++;
                }
            }
            if(ans<count+1){
                ans=count+1;
                num=i;
            }
        }
        return num;
    }
}
